home *** CD-ROM | disk | FTP | other *** search
- Path: realtime.net!usenet
- From: brian_d@sheshunoff.com
- Newsgroups: comp.lang.c++
- Subject: C++ error in borland, is this a compiler bug?
- Date: 1 Mar 1996 22:15:59 GMT
- Organization: Sheshunoff Information Services Inc.
- Message-ID: <4h7suv$760@news2.realtime.net>
- NNTP-Posting-Host: apm1-179.realtime.net
- X-RTcode: d75e2566311f65e16937779a
- X-Newsreader: SPRY News 3.03 (SPRY, Inc.)
-
- I am using borland C++4.52, and OWL. Owl has very little to do with this, though.
- GetModule() returns a TModule *. TModule has a member function LoadString that returns
- a string object. string class has a member function c_str() that return a char * to the actual string.
-
- BOOL newInstl;
- long pgmDirSpace;
-
-
- I get the following error when trying to compile the following (modified for example)
- "Destructor for string required in conditional expression in function ..."
-
-
- pgmDirSpace=newInstl ? atol((GetModule()->LoadString(ROOM_NEW)).c_str())
- : atol((GetModule()->LoadString(ROOM_OVER)).c_str());
-
-
- But if I change it to this, it works fine.
- if(newInstl) pgmDirSpace=atol((GetModule()->LoadString(ROOM_NEW)).c_str());
- else pgmDirSpace=atol((GetModule()->LoadString(ROOM_OVER)).c_str());
-
- This will also compile fine. Thrown in for example only.
- switch(newInstl)
- {
- case TRUE;
- pgmDirSpace=atol((GetModule()->LoadString(ROOM_NEW)).c_str());
- break;
-
- default:
- atol((GetModule()->LoadString(ROOM_OVER)).c_str());
- }
-
-
- I dont see any difference that should matter in any of these examples.
- I obviously have a workaround, but I am also very currious.
- Thanks for any answers to this mystery :o) !
- Brian
-